//1,case中数值1和字符串1不相等
var transStatus = '1';
switch(transStatus){
	case 1:
		console.log("我是case 1");
		break;
	case 2:
		console.log("我是case 2");
		break;
	case 3:
		console.log("我是case 3");
	default :
		console.log("我是default");
}

//2,数值1和字符串1
var a = 1*1;
var b = '1';
console.log(typeof b)
console.log(a==b)//true

//3,for in 循环对象
var obj = {
	name:'jack',
	age:20,
	city:'上海'
}

for(var key in obj){
	console.log(key);
}

//过滤掉对象继承的属性,用hasOwnProperty()实现
for(var key in obj){
	if(obj.hasOwnProperty(key)){
		console.log(key);
	}
}

//4,for in 循环数组(因为数组也是对象,元素的索引被视为对象的key,所以可以直接循环出数组索引)
var arr = ['a','b','c','d'];
for(var index in arr){
	console.log(typeof index);//for in 对数组循环得到的是String 而不是number
	console.log(index);
}

//5,利用for循环计算10的阶乘
var varTemp=1;
for(var i =1;i<=10;i++){
	varTemp = varTemp*i;
}
console.log("10的阶乘是===>"+varTemp);

//6,forEach()
var arr = ['a','b','c','d'];
arr.forEach(function(element,index,array){
	//element指向当前元素的值
	//index指向当前索引
	//指向当前对象本身
	console.log(element,index,array);
})